<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>网易新闻2</title>
    <style>
        .bok {
            width: 500px;
            margin-top: 50px;
            background-color: grey;

        }

        .top {
            display: flex;
            /*background-color: blue;*/
            justify-content: space-between;
            align-content: space-between;

        }

        .top-img img {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            line-height: 80px;
        }

        .top-zhong {
            width: 300px;
        }

        .top-right {
            width: 100px;
        }

        .bu-img img {
            width: 300px;
        }

        .top-right {
            line-height: 80px;
        }


    </style>
</head>
<body>
<div id="root">
    <button @click="click">点击展示</button>
    <one :hh="this.arr"></one>
</div>
<template id="one">
    <div id="two">
        <div>{{"你哈哈哈"}}</div>
        <div :key="v.docid" class="bok" v-for="(v,i) in hh">
            <div class="top">
                <div class="top-img"><img alt="" :src="v.imgsrc"></div>
                <div class="top-zhong"><h3>{{v.source}}</h3>
                    <span>{{v.lmodify}}</span><span>{{v.source}}</span></div>
                <div class="top-right">关注</div>
            </div>
            <h3>{{v.title}}</h3>
            <div class="content">{{v.digest}}</div>
            <div class="bu-img"><img
                    :src="v.imgsrc"
                    alt=""></div>
        </div>

    </div>
</template>
</body>
</html>
<script src="node_modules/jquery/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script>
    $.ajax({
        type: "get",
        url: "http://127.0.0.1:3311/get",
        data: {},
        success: function (data) {
            // console.log(data);
            var arr = JSON.parse(data)["T1348647853363"];
            jie(arr);
            console.log(arr)

        }
    })

    function jie(arr) {
        let news = new Vue();
        let one = {
            template: "#one",
            data: function () {
                return {
                    hh: '',
                }
            },
            methods: {
                fu(a) {
                    this.hh = a;
                }
            },
            created: function () {

                news.$on("off", (a) => {
                    this.hh = a;
                })

            },


        }
        new Vue({
            el: "#root",
            data: {
                arr: arr,

            },
            //    函数
            methods: {
                click() {
                    news.$emit("off", this.arr)
                }
            },
            components: {
                one,
            }
        })
    }

</script>
